//
//  XS_NotificationListCell.swift
//  XueDao
//
//  Created by Mac on 2020/12/11.
//

import UIKit

class XS_NotificationListCell: UITableViewCell {

    @IBOutlet weak var imgView: UIImageView!
    @IBOutlet weak var redPointView: UIView!
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var timeLabel: UILabel!
    @IBOutlet weak var contentLabel: UILabel!
    
    var _model : XS_NotificationListModel!
    public var model : XS_NotificationListModel!{
        set{
            _model = newValue
            //设置数据
            redPointView.isHidden = newValue.state != "notread"
            titleLabel.text = newValue.type == "ordinaryMsg" ? "官方消息" : "其他消息"
            contentLabel.text = newValue.content
            timeLabel.text = newValue.createTime
        }
        get{
            return _model
        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    public class func getCellHeight(model:XS_NotificationListModel) -> CGFloat{
        let contentStr = model.content as NSString
        let height = 60 + contentStr.boundingRect(with: CGSize.init(width: .screenWidth - 68 - 17, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 14)], context: nil).height
        return height
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
